/**
 * @author Andrew Dashin <dashin@andrewdashin.com>
 */

var Settings = {
	
	defaultSettings: {
		"language": "en"
	},
		
	get: function (sName) {
		var allSettings = 	document.cookie.split( ';' );
		var tempSetting;
		
		for ( i = 0; i < allSettings.length; i++ )
		{
			tempSetting = allSettings[i].split( '=' );
			if ( tempSetting[0].replace(/^\s+|\s+$/g, '') == sName )
			{
				return unescape( tempSetting[1].replace(/^\s+|\s+$/g, '') );
			}
		}
		
		if ( typeof this.defaultSettings[sName] != "undefined")
		{
			return this.defaultSettings[sName];
		} else {
			return null;
		}
	},
	
	set: function (sName, sValue) {
		document.cookie = sName + "=" +escape( sValue ) +
			( ";expires=;path=/;domain=" + document.domain);
	}
}